const state = {
	dynamic_title: '',
	showSidebar: true,
	isMap:true,
	filiale:-1,
	area:{},
	payconfig:[],
	areatitle:'',
	goadmin: true,
	CurrentlySelectedToolBar : {
		Type: '',//选中的工具栏svg类型
		TypeName: '',//选中的工具栏svg类型名称
		Title: '',//选中的工具栏svg标题
		Color: '',//选中的工具栏svg颜色
		CreateType: '',//选中工具栏的创建方式
		EChartsOption:''//选中工具栏的图表默认option
	}
}

const mutations = {
	// 动态的标题
	setDynamicTitle: (state, name) => {
		state.dynamic_title = name
	},
	setSidebar: (state, value) => {
		state.showSidebar = value
	},
	setisMap: (state, value) => {
		state.isMap = value
	},
	setfiliale: (state, value) => {
		state.filiale = value
	},
	setArea: (state, value) => {
		state.area = value
	},
	setPayconfig: (state, value) => {
		state.payconfig = value
	},
	setAreatitle: (state, value) => {
		state.areatitle = value
	},
	setGoadmin: (state, value) => {
		state.goadmin = value
	},
	setCurrentlySelectedToolBar: (state, value) => {
		state.CurrentlySelectedToolBar = value
	},
}

const actions = {
	dynamicTitleAction({ commit }, name) {
		commit('setDynamicTitle', name)
	},
	setDeviceTypeAction({ commit }, type) {
		commit('setDeviceType', type)
	},
	showSidebarAction({ commit }, value) {
		commit('setSidebar', value)
	},
	setisMapAction({ commit }, value) {
		commit('setisMap', value)
	},
	setfilialeAction({ commit }, value) {
		commit('setfiliale', value)
	},
	AreaAction({ commit }, value) {
		commit('setArea', value)
	},
	setPayconfigAction({ commit }, value) {
		commit('setPayconfig', value)
	},
	setAreatitleAction({ commit }, value) {
		commit('setAreatitle', value)
	},
	setGoadminAction({ commit }, value) {
		commit('setGoadmin', value)
	},
	setCurrentlySelectedToolBarAction({ commit }, value) {
		commit('setCurrentlySelectedToolBar', value)
	},
	clearCurrentlySelectedToolBarAction({ commit }) {
		let value = {
      Type: '',//选中的工具栏svg类型
      TypeName: '',//选中的工具栏svg类型名称
      Title: '',//选中的工具栏svg标题
      Color: '',//选中的工具栏svg颜色
      CreateType: '',//选中工具栏的创建方式
      EChartsOption:''//选中工具栏的图表默认option
    }
		commit('setCurrentlySelectedToolBar', value)
	},
}

export default {
	namespaced: true,
	state,
	mutations,
	actions,
}
